import { BaseEntity } from "src/baseEntity";
import { System } from "src/system/system.entity";
import { UserSys } from "src/user/userSys.entity";
import { Column, Entity, ManyToOne } from "typeorm";
import { Workflow } from "./workflow.entity";




export enum ApplicationStatus {
    applying = "申请中",
    rejected = "拒绝申请",
    finished = "已完成"
}


@Entity("apply")
export class Apply extends BaseEntity {
    @ManyToOne(() => System)
    system: System

    @ManyToOne(() => Workflow)
    current: Workflow

    @ManyToOne(() => UserSys)
    user: UserSys

    @Column({ comment: "申请类型" })
    name: string

    @Column({ type: "enum", enum: ApplicationStatus, default: ApplicationStatus.applying })
    status: ApplicationStatus

    @Column()
    data: string

    @Column({ nullable: true })
    comment: string

    workflow: Workflow
}